using System.Collections.Generic;

namespace SqlQueryBuilder.Clauses
{
    public class OrderByClause
    {
        /// <summary>
        /// Gets or sets the fields.
        /// </summary>
        /// <value>The fields.</value>
        public IList<string> Fields { get; set; }
        /// <summary>
        /// Gets or sets a value indicating whether this instance is ascendant.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is ascendant; otherwise, <c>false</c>.
        /// </value>
        public bool IsAscendant { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="OrderByClause"/> class.
        /// </summary>
        /// <param name="field">The field.</param>
        public OrderByClause(string field)
        {
            IsAscendant = true;
            Fields = new List<string> {field};
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="OrderByClause"/> class.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="ascendent">if set to <c>true</c> [ascendent].</param>
        public OrderByClause(string field, bool ascendent)
        {
            IsAscendant = ascendent;
            Fields = new List<string> {field};
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="OrderByClause"/> class.
        /// </summary>
        /// <param name="fields">The fields.</param>
        public OrderByClause(params string[] fields)
        {
            IsAscendant = true;
            Fields = new List<string>();
            foreach (var field in fields)
            {
                Fields.Add(field);
            }
        }
     
    }
}